package com.accp.restaurant.controller;

import com.accp.restaurant.dao.SssDao;
import com.accp.restaurant.dao.StatisticsDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("/Statistics")
public class StatisticsController {

    @Autowired
    private StatisticsDao statisticsDao;
    @Autowired
    private SssDao sssDao;

    @RequestMapping("Statistics")
    @ResponseBody
    public Map<String,Object> query(long date){
        Map<String,Object> map = new HashMap<String,Object>();
        if(date==1){
            map.put("list",sssDao.findAll());
        }else if(date==2){
            map.put("list",sssDao.findAll1());
        }else if(date==3){
            map.put("list",sssDao.findAll2());
        }
        return map;
    }


}
